//
//  WmcBubbleGuideView.swift
//  YPWatermarkCamera
//
//  Created by Json on 2023/8/7.
//

import UIKit

class WmcBubbleGuideView: WmcBaseGuideView {
    
    var arrowDirection: WmcButtonBubbleView.ArrowDirection {
        return .up
    }

    /// 气泡提示
    private(set) lazy var bubbleView: WmcButtonBubbleView = {
        let view = WmcButtonBubbleView(arrowDirection: arrowDirection)
        return view
    }()
    /// 引导线
    private(set) lazy var lineView: UIImageView = {
        let imgView = UIImageView()
        return imgView
    }()
    /// 控件宽度
    let viewWidth: CGFloat
    
    /// 镂空的范围
    override var maskFrame: CGRect {
        didSet {
            _layoutSubviews()
        }
    }
    
    /// 点击按钮回调
    let okButtonAction: PublishRelay<Void> = .init()
    
    // MARK: Init
    init(width: CGFloat = Wmc_screenWidth, maskFrame: CGRect) {
        self.viewWidth = width
        super.init(maskFrame: maskFrame)
    }
    
    public required convenience init() {
        self.init(maskFrame: .zero)
    }
    
    override func makeUI() {
        super.makeUI()
        // 引导线
        addSubview(lineView)
        // 气泡
        addSubview(bubbleView)
        // 布局
        _layoutSubviews()
    }
    
    // MARK: Bind Action
    override func bindViewAction() {
        super.bindViewAction()
        bubbleView.okButtonAction.bind(to: okButtonAction).disposed(by: rx.disposeBag)
    }

    
    func _layoutSubviews() {}
}
